<?php
getHeader();

if (isset($_GET['aid']))
{
	?>
<div id="content">
<div class="tabs headTabs"><?php 
$album = imageFile::getAlbumByAid($_GET['aid']);
if (isset($_SESSION['authPassed']))
{
	?>
<ul>
	<li><a href='?p=viewAlbum' class="TabLink">所有相册</a></li>
	<li><a href='?p=editAlbum&aid=<?php echo $_GET['aid']; ?>'
		class="TabLink">相册操作</a></li>
</ul>
	<?php
	echo '<span>我的相册: '.$album['albumName'].'</span>';
}
else
{
	echo '<span>用户相册: '.$album['albumName'].'</span>';
}
?> <?php

?></div>
<div class="dataList">
<ul class="albumList">
<?php
$result = imageFile::getImageByAid((int)$_GET['aid']);
while ($i = mysql_fetch_array($result))
{
	?>
	<a href='?p=viewImage&iName=<?php echo $i['imageName']; ?>'>
	<li><img src='<?php echo UPLOADURL.$i['imageName']; ?>'><br />
	<span><?php echo substr($i['imageName'],6,strripos($i['imageName'], '.') - 6); ?></span>
	</li>
	</a>
	<?php
}
?>
	<li style="clear: both; float: none;"></li>
</ul>
</div>
</div>
<?php
}
else if (isset($_SESSION['authPassed']) && $_SESSION['authPassed'] == "TRUE")
{
	$viewingUser = userProf::getUserByUid((int)$_SESSION['uid']);
	?>
<div id="content">
<div class="tabs headTabs">
<ul>
	<li><a href='?p=imageUpload' class="TabLink" style="font-size: 14px;">上传相片</a>
	</li>
</ul>
<span>我的相册</span></div>
<div class="dataList"><?php
$result = $viewingUser->getUserAlbum();
if ($result == "NO")
{
	echo "<span>你还没有<a href='?p=imageUpload&action=createAlbum'>创建</a>相册.</span>";
}
else
{
	?>
<ul class="albumList">
<?php
$album = $viewingUser->getUserAlbum();
while ($arr = mysql_fetch_array($album))
{
	?>
	<a href='?p=viewAlbum&aid=<?php echo $arr['aid']; ?>'>
	<li><img src="<?php echo getAlbumFirstImageUrl($arr['aid']); ?>"><br />
	<span><?php echo $arr['albumName']; ?></span></li>
	</a>
	<?php
}
?>
	<li style="clear: both; float: none;"></li>
</ul>
<?php
}
?></div>
</div>
<?php
}
else
{
	?>
<div id="content">
<div class="tabs headTabs"><span>用户相册</span></div>
<div class="dataList"><span> 你当前为游客, 无法查看本人相册, 请指定一个用户的相册. </span></div>
</div>
	<?php
}
getPanel();
getFooter();
?>